<?php

class Pictures_Image_DisplayAction extends BlogPicturesBaseAction
{
    
    public function executeRead(AgaviRequestDataHolder $rd)
    {
        $params = $rd->getParameters();
	    /* @var $model Pictures_PicturesModel */
	    $model = $this->getContext()->getModel('Pictures', 'Pictures');
	    $vm = $this->getContainer()->getValidationManager();
	    
	    $picture = $model->getPicture(null, $params['pic_name']);
	    if (is_null($picture)) {
	        $vm->setError('general', 'Unknown picture');
	        return 'Error';
	    }
	    $this->setAttribute('picture', $picture);
        return 'Success';
    }
    
	/**
	 * Returns the default view if the action does not serve the request
	 * method used.
	 *
	 * @return     mixed <ul>
	 *                     <li>A string containing the view name associated
	 *                     with this action; or</li>
	 *                     <li>An array with two indices: the parent module
	 *                     of the view to be executed and the view to be
	 *                     executed.</li>
	 *                   </ul>
	 */
	public function getDefaultViewName()
	{
		return 'Success';
	}
	
	public function isSecure()
	{
	    return false;
	}
}

?>